<?php namespace App\Http\Controllers;

use App\AddressInfo;
use App\Answers;
use App\Banner;
use App\EducationExperience;
use App\EduWorkLabel;
use App\Http\Services\FileManager;
use App\Classify;
use App\InvitingAdvert;
use App\InvitingClassify;
use App\Jobs\Job;
use App\JoyInfo;
use App\Notice;
use App\Orders;
use App\Resume;
use App\SkillLabel;
use App\User;
/*use App\UserInfo;*/
use App\Userinfo;
use App\Position;
use App\SetTopRule;
use App\SetTopRecord;
use App\PositonResume;
use App\PersonalAuth;
use App\CompanyInfo;
use App\PositionImg;
use App\ProjectInfo;
use App\FeedBack;
use App\Admin;
use App\Trade;
use App\JobType;
use App\WorkExperience;
use Illuminate\Contracts\Auth\Guard;
use Auth;
use DB;
use Illuminate\Http\Request;

class AdminController extends Controller
{
    public function login ()
    {
        return view('admin.login');
    }

    public function userList (Request $request)
    {
        if (Auth::guard("admin")->guest())
            return response()->json(['level' => 'error', 'message' => '请先登录！']);

        $users = Userinfo::orderBy("created_at", "desc")->paginate(50);
        if (count($users) > 0) {
            foreach ($users as $user) {
                $theUser = User::whereId($user->user_id)->first();
                $user->phone = $theUser ? $theUser->phone : null;
                $user->photo_url = FileManager::getImgFromOssUrl($user->photo_id);
            }
        }


        return view('admin.user-list', ["users" => $users]);
    }

    public function userListDetail (Request $request)
    {
        if (Auth::guard("admin")->guest())
            return response()->json(['level' => 'error', 'message' => '请先登录！']);

        $id = !is_null($request->get('id')) ? $request->get('id') : 0;

        $users = Userinfo::whereId($id)->first();
        if ($users) {
            $theUser = User::whereId($users->user_id)->first();
            $users->phone = $theUser ? $theUser->phone : null;
            $users->photo_url = FileManager::getImgFromOssUrl($users->photo_id);
        }


        return view('admin.user-list-detail', ["users" => $users]);
    }

    public function companyInfoList (Request $request)
    {
        if (Auth::guard("admin")->guest())
            return response()->json(['level' => 'error', 'message' => '请先登录！']);

        $companyInfos = CompanyInfo::orderBy('created_at', 'desc')->paginate(50);
        if (count($companyInfos) > 0) {
            foreach ($companyInfos as $companyInfo) {
                /** @var UserInfo $userInfo */
                $theUser = User::whereId($companyInfo->user_id)->first();
                $trade = Trade::whereId($companyInfo->industry_id)->first();
                $companyInfo->phone = $theUser ? $theUser->phone : "无";
                $companyInfo->trade = $trade ? $trade->name : "无";
                $companyInfo->photo_url = FileManager::getImgFromOssUrl($companyInfo->photo_id);
            }
        }

        return view('admin.company-info-list', ['companyInfos' => $companyInfos]);
    }


    public function companyInfoListDetail (Request $request)
    {
        if (Auth::guard("admin")->guest())
            return response()->json(['level' => 'error', 'message' => '请先登录！']);

        $id = !is_null($request->get('id')) ? $request->get('id') : 0;

        $companyInfoDetail = CompanyInfo::whereId($id)->first();
        if (count($companyInfoDetail) > 0) {
            /** @var UserInfo $userInfo */
            $theUser = User::whereId($companyInfoDetail->user_id)->first();
            $trade = Trade::whereId($companyInfoDetail->industry_id)->first();
            $companyInfoDetail->phone = $theUser ? $theUser->phone : "无";
            $companyInfoDetail->trade = $trade ? $trade->name : "无";
            $companyInfoDetail->photo_url = FileManager::getImgFromOssUrl($companyInfoDetail->photo_id);
        }

        return view('admin.company-info-list-detail', ['companyInfoDetail' => $companyInfoDetail]);
    }

    public function personalAuthList (Request $request)
    {
        $phone = $request->get('phone');


        if (Auth::guard("admin")->guest())
            return response()->json(['level' => 'error', 'message' => '请先登录！']);

        if (is_null($phone) || $phone == "") {

            $personalAuths = PersonalAuth::orderBy('created_at', 'desc')->paginate(50);
        } else {
            /** @var User $user */
            $user = User::wherePhone($phone)->first();
            if (!$user) {
                $personalAuths = PersonalAuth::orderBy('created_at', 'desc')->paginate(50);
            } else {
                $personalAuths = PersonalAuth::whereUserId($user->id)->paginate(50);;

            }


        }

        if (count($personalAuths) > 0) {
            foreach ($personalAuths as $personalAuth) {
                $theUser = User::whereId($personalAuth->user_id)->first();
                $userInfo = Userinfo::whereUserId($personalAuth->user_id)->first();
                $personalAuth->personal_auth = $userInfo ? $userInfo->personal_auth : null;
                $personalAuth->phone = $theUser ? $theUser->phone : null;
                $personalAuth->idcard_front_url = FileManager::getImgFromOssUrl($personalAuth->idcard_front_id);
                $personalAuth->idcard_back_url = FileManager::getImgFromOssUrl($personalAuth->idcard_back_id);
            }
        }

        return view('admin.personal-auth-list', ['personalAuths' => $personalAuths]);
    }

    public function companyAuthList (Request $request)
    {

        $phone = $request->get('phone');
        if (Auth::guard("admin")->guest())
            return response()->json(['level' => 'error', 'message' => '请先登录！']);

        if (is_null($phone) || $phone == "") {

            $companyAuths = CompanyInfo::orderBy('created_at', 'desc')->paginate(50);
        } else {

            /** @var User $user */
            $user = User::wherePhone($phone)->first();
            if (!$user) {
                $companyAuths = CompanyInfo::orderBy('created_at', 'desc')->paginate(50);
            } else {
                $companyAuths = CompanyInfo::whereUserId($user->id)->paginate(50);
            }

        }

        if (count($companyAuths) > 0 && $companyAuths) {
            foreach ($companyAuths as $companyAuth) {
                $theUser = User::whereId($companyAuth->user_id)->first();
                $userInfo = Userinfo::whereUserId($companyAuth->user_id)->first();
                $companyAuth->company_auth = $userInfo ? $userInfo->company_auth : null;
                $companyAuth->phone = $theUser ? $theUser->phone : null;
                $companyAuth->license_img_url = FileManager::getImgFromOssUrl($companyAuth->license_img_id);
            }
        }

        return view('admin.company-auth-list', ['companyAuths' => $companyAuths]);
    }

    public function bannerList ()
    {

        if (Auth::guard('admin')->guest())
            return redirect(route('Admin.Home.login'));

        $sysBanners = Banner::orderBy('sort', 'asc')->orderBy('created_at', 'desc')->paginate(50);

        if (count($sysBanners) > 0) {
            foreach ($sysBanners as $banner) {
                $banner->img_url = FileManager::getImgFromOssUrl($banner->img_id);
            }
        }

        $user = Auth::guard('admin')->user();

        $pp = $user->username;

        $isAdmin = Admin::where('username', $pp)->first();

        return view('admin.banner-list', ['banners' => $sysBanners, 'isAdmin' => $isAdmin]);
    }

    public function bannerSet (Request $request)
    {
        if (Auth::guard('admin')->guest())
            return redirect(route('Admin.Home.login'));

        $id = !is_null($request->get('id')) ? $request->get('id') : 0;

        $thatBanner = Banner::whereId($id)->first();

        $user = Auth::guard('admin')->user();

        $pp = $user->username;

        $isAdmin = Admin::where('username', $pp)->first();

        return view('admin.banner-set', ['banner' => $thatBanner, 'isAdmin' => $isAdmin]);
    }

    public function positionList (Request $request)
    {
        if (Auth::guard('admin')->guest())
            return redirect(route('Admin.Home.login'));

        $positions = Position::orderBy('sort', 'asc')->orderBy('created_at', 'desc')->paginate(50);
        if (count($positions) > 0) {
            foreach ($positions as $position) {
                $trade = Trade::whereId($position->trade_id)->first();
                $jobType = JobType::whereId($position->job_type_id)->first();
                $theUser = User::whereId($position->user_id)->first();
                $position->trade = $trade ? $trade->name : "无";
                $position->job_type = $jobType ? $jobType->name : "无";
                $position->phone = $theUser ? $theUser->phone : 0;
            }
        }

        return view('admin.position-list', ['positions' => $positions]);
    }

    public function positionResumeList (Request $request)
    {
        if (Auth::guard('admin')->guest())
            return redirect(route('Admin.Home.login'));

        $positionId = !is_null($request->get('position_id')) ? $request->get('position_id') : 0;

        /** @var PositonResume $positionResumes */
        $positionResumes = PositonResume::wherePositionId($positionId)->get();
        $resumeId = array();
        if (count($positionResumes) > 0) {
            foreach ($positionResumes as $resume) {
                array_push($resumeId, $resume->resume_id);
            }
        }

        $resumes = Resume::whereIn('id', $resumeId)->paginate(50);
        if (count($resumes) > 0) {
            foreach ($resumes as $resume) {
                $userInfo = Userinfo::whereUserId($resume->user_id)->first();
                $jobType = JobType::whereId($resume->job_type_id)->first();
                $userInfo->photo_url = $userInfo ? FileManager::getImgFromOssUrl($userInfo->photo_id) : null;
                $resume->job_type = $jobType ? $jobType->name : 0;
                $resume->user_info = $userInfo;
            }
        }

        return view('admin.position-resume-list', ['resumes' => $resumes]);
    }

    public function resumeListDetail (Request $request)
    {
        if (Auth::guard('admin')->guest())
            return redirect(route('Admin.Home.login'));

        /*     $resumeId = !is_null($request->get('resume_id')) ? $request->get('resume_id') : 0 ;

             $thisResume = Resume::whereId($resumeId)->first();
             if($thisResume){
                 $userInfo =Userinfo::whereUserId($thisResume->user_id)->first();
                 $jobType = JobType::whereId($thisResume->job_type_id)->first();
                 $userInfo->photo_url = $userInfo ? FileManager::getImgFromOssUrl($userInfo->photo_id) : null;
                 $thisResume->job_type = $jobType ? $jobType->name : 0 ;
                 $thisResume->user_info = $userInfo;
             }
             */
        $resume_id = $request->get('resume_id');


        $thatResume = Resume::whereId($resume_id)->first();
        if (!$thatResume)
            return response()->json(['level' => 'error', 'message' => '简历已经被删除！']);


        $thatUserInfo = Userinfo::whereUserId($thatResume->user_id)->first();
        if (!$thatUserInfo)
            return response()->json(['level' => 'error', 'message' => '用户数据错误！']);


        $thatUserInfo->photo_url = FileManager::getImgFromOssUrl($thatUserInfo->photo_id);

        $thatJobType = JobType::whereId($thatResume->job_type_id)->first();

        $jobName = $thatJobType ? $thatJobType->name : "无";

        $thatResume->user_info = $thatUserInfo;
        $thatResume->job_name = $jobName;

        $name = ['edu', 'work', 'label'];


        $eduWorkLabel = EduWorkLabel::whereUserId($thatResume->user_id)->get();
        /*
                $thatResume['edu']=array();
                $thatResume['work']=array();
                $thatResume['label']=array();*/
        $result = array();

        if (count($eduWorkLabel) > 0) {
            if (count($name) > 0) {
                foreach ($name as $value) {
                    $type['name'] = $value;
                    $type['list'] = array();

                    $resume[$value] = array();


                    $items = EduWorkLabel::whereType($value)->whereUserId($thatResume->user_id)->get();
                    $typeIds = array();
                    if (count($items) > 0) {
                        foreach ($items as $item) {
                            if ($value == "label") {
                                $typeIds = explode(',', $item->label_id);

                            } else {
                                array_push($typeIds, $item->type_id);
                            }
                        }
                    }

                    if (count($typeIds) > 0) {
                        foreach ($typeIds as $typeId) {

                            if ($value == "edu") {
                                $resume = EducationExperience::whereId($typeId)->first();
                            }
                            if ($value == "work") {
                                $resume = WorkExperience::whereId($typeId)->first();
                            }
                            if ($value == "label") {
                                $resume = SkillLabel::whereId($typeId)->first();
                            }


                            array_push($type['list'], $resume);
                        }
                    }
                    /*                array_push($thatResume,$type);*/
                    $thatResume[$value] = $type['list'];
                    /*                array_push($result,$type);*/

                }

            }
        }

        return view('admin.position-resume-list-detail', ['thisResume' => $thatResume]);


        /*        return view('admin.position-resume-list-detail',['thisResume' => $thisResume]);*/
    }


    public function positionListDetail (Request $request)
    {
        if (Auth::guard('admin')->guest())
            return redirect(route('Admin.Home.login'));

        $id = !is_null($request->get('id')) ? $request->get('id') : 0;

        $thatPosition = Position::whereId($id)->first();
        if (count($thatPosition) > 0) {
            $trade = Trade::whereId($thatPosition->trade_id)->first();
            $jobType = JobType::whereId($thatPosition->job_type_id)->first();
            $theUser = User::whereId($thatPosition->user_id)->first();
            $thatPosition->trade = $trade ? $trade->name : "无";
            $thatPosition->job_type = $jobType ? $jobType->name : "无";
            $thatPosition->phone = $theUser ? $theUser->phone : 0;

            $positionImgs = PositionImg::wherePositionId($thatPosition->id)->get();
            $positionImgUrls = array();
            if (count($positionImgs) > 0) {
                foreach ($positionImgs as $positionImg) {
                    /** @var PositionImg $positionImgs */
                    $positionImgUrl = FileManager::getImgFromOssUrl($positionImg->img_id);
                    array_push($positionImgUrls, $positionImgUrl);
                }
            }
            $thatPosition->position_img_urls = $positionImgUrls;
        }

        return view('admin.position-list-detail', ['thatPosition' => $thatPosition]);
    }

    public function tradeList (Request $request)
    {
        if (Auth::guard('admin')->guest())
            return redirect(route('Admin.Home.login'));

        $trades = Trade::orderBy('sort', 'asc')->orderBy('created_at', 'desc')->paginate(50);

        return view('admin.trade-list', ['trades' => $trades]);
    }

    public function jobTypeList (Request $request)
    {
        if (Auth::guard('admin')->guest())
            return redirect(route('Admin.Home.login'));

        $jobTypes = JobType::orderBy('created_at', 'desc')->paginate(50);
        if (count($jobTypes) > 0) {
            foreach ($jobTypes as $jobType) {
                $trades = Trade::whereId($jobType->trade_id)->first();
                $jobType->trade = $trades ? $trades->name : "无";
            }
        }

        $trades = Trade::orderBy('sort', 'asc')->orderBy('created_at', 'desc')->get();
        return view('admin.job-type-list', ['jobTypes' => $jobTypes]);
    }

    public function jobTypeSet (Request $request)
    {
        if (Auth::guard('admin')->guest())
            return redirect(route('Admin.Home.login'));

        $id = !is_null($request->get('id')) ? $request->get('id') : 0;

        $jobType = JobType::whereId($id)->first();

        $trades = Trade::orderBy('sort', 'asc')->orderBy('created_at', 'desc')->get();

        return view('admin.job-type-set', ['trades' => $trades, 'jobType' => $jobType]);
    }

    public function projectList (Request $request)
    {

        /** 关于我们 */
        if (Auth::guard('admin')->guest())
            return redirect(route('Admin.Home.login'));

        $projectInfo = ProjectInfo::whereType('about_us')->first();
        if ($projectInfo) {
            $projectInfo->img_url = FileManager::getImgFromOssUrl($projectInfo->img_id);
        }

        return view('admin.project-list', ['projectInfo' => $projectInfo]);
    }

    public function projectSet (Request $request)
    {
        /** 联系我们 */
        if (Auth::guard('admin')->guest())
            return redirect(route('Admin.Home.login'));

        $id = !is_null($request->get('id')) ? $request->get('id') : 0;

        $thatProjectInfo = ProjectInfo::whereId($id)->first();

        return view('admin.project-set', ['thatProjectInfo' => $thatProjectInfo]);
    }

    public function infoList (Request $request)
    {
        if (Auth::guard('admin')->guest())
            return redirect(route('Admin.Home.login'));

        $projectInfo = ProjectInfo::whereType('contact_us')->first();
        if ($projectInfo) {
            $projectInfo->img_url = FileManager::getImgFromOssUrl($projectInfo->img_id);
        }

        return view('admin.info-list', ['projectInfo' => $projectInfo]);
    }

    public function infoSet (Request $request)
    {
        if (Auth::guard('admin')->guest())
            return redirect(route('Admin.Home.login'));

        $id = !is_null($request->get('id')) ? $request->get('id') : 0;

        $thatProjectInfo = ProjectInfo::whereId($id)->first();

        return view('admin.info-set', ['thatProjectInfo' => $thatProjectInfo]);
    }

    public function feedBacksList (Request $request)
    {
        if (Auth::guard('admin')->guest())
            return redirect(route('Admin.Home.login'));

        $feedBacks = FeedBack::orderBy('created_at', 'desc')->paginate(50);
        if (count($feedBacks) > 0) {
            foreach ($feedBacks as $feedBack) {
                $feedBack->img_url = FileManager::getImgFromOssUrl($feedBack->img_id);
            }
        }

        return view('admin.feed-backs-list', ['feedBacks' => $feedBacks]);
    }

    public function TopRecordList (Request $request)
    {
        if (Auth::guard('admin')->guest())
            return redirect(route('Admin.Home.login'));

        $topRecords = SetTopRecord::orderBy('created_at', 'desc')->paginate(50);

        return view('admin.top-record-list', ['topRecords' => $topRecords]);
    }

    public function setTopRuleList (Request $request)
    {
        if (Auth::guard('admin')->guest())
            return redirect(route('Admin.Home.login'));

        $setTopRules = SetTopRule::orderBy('created_at', 'desc')->paginate(50);

        return view('admin.set-top-rule-list', ['setTopRules' => $setTopRules]);
    }

    public function setTopRuleSet (Request $request)
    {
        if (Auth::guard('admin')->guest())
            return redirect(route('Admin.Home.login'));

        $id = !is_null($request->get('id')) ? $request->get('id') : 0;

        $thisSetTopRule = SetTopRule::whereId($id)->first();

        return view('admin.set-top-rule-set', ['thisSetTopRule' => $thisSetTopRule]);
    }

    public function ordersList (Request $request)
    {
        if (Auth::guard('admin')->guest())
            return redirect(route('Admin.Home.login'));

        $orders = Orders::orderBy('created_at', 'desc')->paginate(50);
        if (count($orders) > 0) {
            foreach ($orders as $order) {
                $user = User::whereId($order->user_id)->first();
                $order->phone = $user ? $user->phone : "无";
            }
        }

        return view('admin.orders-list', ['orders' => $orders]);
    }

    public function changePwd ()
    {
        if (Auth::guard('admin')->guest())
            return redirect(route('Admin.Home.login'));

        $user = Auth::guard('admin')->user();

        $pp = $user->username;

        $isAdmin = Admin::where('username', $pp)->first();
        return view('admin.change-psw', ['isAdmin' => $isAdmin]);
    }

    public function invitingAdvertList (Request $request)
    {
        if (Auth::guard('admin')->guest())
            return redirect(route('Admin.Home.login'));

        $adverts = InvitingAdvert::orderBy('created_at', 'desc')->paginate(50);

        if (count($adverts) > 0) {
            foreach ($adverts as $advert) {
                /** @var InvitingAdvert $advert */
                $advert->photo_url = $advert ? FileManager::getImgFromOssUrl($advert->img_id) : "0";
                $classify = Classify::whereId($advert->classify_id)->first();
                $classifyName = $classify ? $classify->name : "该分类已被删除";
                $advert->classify = $classifyName;

                $classifyTwo = InvitingClassify::whereId($advert->inviting_classify_id)->first();
                $classifyTwoName = $classifyTwo ? $classifyTwo->name : "未划分板块";
                $advert->bankuai = $classifyTwoName;
            }
        }
        return view('admin.inviting-advert-list', ['adverts' => $adverts]);
    }

    public function invitingAdvertSet (Request $request)
    {
        if (Auth::guard('admin')->guest())
            return redirect(route('Admin.Home.login'));
        $id = !is_null($request->get('id')) ? $request->get('id') : 0;
        $thatInvitingAdvert = InvitingAdvert::whereId($id)->first();
        $classifies = Classify::wherePid('0')->whereType('advert')->get();

        $bankuais = InvitingClassify::all();

        return view('admin.inviting-advert-set', ['advert' => $thatInvitingAdvert, 'classify' => $classifies, "bankuais" => $bankuais]);

    }

    public function invitingAdvertClassifyList (Request $request)
    {
        if (Auth::guard('admin')->guest())

            return redirect(route('Admin.Home.login'));
        $classifies = Classify::wherePid('0')->whereType('advert')->paginate(20);
        return view('admin.inviting-advert-classify-list', ['classifies' => $classifies]);

    }

    public function resumeList (Request $request)
    {
        if (Auth::guard('admin')->guest())

            return redirect(route('Admin.Home.login'));
        $resumes = Resume::orderBy('created_at', 'desc')->paginate(50);
        if (count($resumes) > 0) {
            foreach ($resumes as $resume) {
                $userInfos = Userinfo::whereUserId($resume->user_id)->get();
                if (count($userInfos) > 0) {
                    foreach ($userInfos as $userInfo) {

                        $resume->photo_url = FileManager::getImgFromOssUrl($userInfo->photo_id);
                        $resume->photo_id = $userInfo->photo_id;
                        $resume->realname = $userInfo->realname;
                        $resume->sex = $userInfo->sex;
                        $resume->skill = $userInfo->skill;

                    }
                }

                $jobTypes = JobType::whereId($resume->job_type_id)->get();
                if (count($jobTypes) > 0) {
                    foreach ($jobTypes as $jobType) {
                        $resume->job_type_id = $jobType->name;
                    }
                }

            }
        }

        return view('admin.resume-list', ['resumes' => $resumes, 'userInfos' => $userInfo, 'jobTypes' => $jobTypes]);
    }

    public function joyInfoList (Request $request)
    {
        if (Auth::guard('admin')->guest())

            return redirect(route('Admin.Home.login'));
        $joys = JoyInfo::orderBy('created_at', 'desc')->paginate(20);

        if (count($joys) > 0) {
            foreach ($joys as $joy) {
                $joy->photo_url = $joy ? FileManager::getImgFromOssUrl($joy->img_id) : "0";
            }
        }
        return view('admin.joy-list', ['joys' => $joys]);
    }

    public function joySet (Request $request)
    {
        if (Auth::guard('admin')->guest())

            return redirect(route('Admin.Home.login'));
        $id = !is_null($request->get('id')) ? $request->get('id') : 0;
        $thatJoy = JoyInfo::whereId($id)->first();

        return view('admin.joy-set', ['joy' => $thatJoy]);
    }


    public function noticeList (Request $request)
    {
        if (Auth::guard('admin')->guest())
            return redirect(route('Admin.Home.login'));

        $notices = Notice::orderBy('created_at', 'desc')->paginate(30);

        return view('admin.notice-list', ['notices' => $notices]);
    }

    public function noticeSet (Request $request)
    {
        if (Auth::guard('admin')->guest())
            return redirect(route('Admin.Home.login'));

        $id = !is_null($request->get('id')) ? $request->get('id') : 0;
        $notice = Notice::whereId($id)->first();

        return view('admin.notice-set', ['notice' => $notice]);

    }

    public function addressInfoList ()
    {
        if (Auth::guard('admin')->guest())
            return redirect(route('Admin.Home.login'));

        $address = AddressInfo::orderBy('created_at', 'desc')->paginate(50);
        return view('admin.address-list', ['addresses' => $address]);
    }


    public function addressSet (Request $request)
    {
        if (Auth::guard('admin')->guest())
            return redirect(route('Admin.Home.login'));

        $id = !is_null($request->get('id')) ? $request->get('id') : 0;

        $address = AddressInfo::whereId($id)->first();

        return view('admin.address-set', ['address' => $address]);

    }


    public function resumeUserDetail (Request $request)
    {
        if (Auth::guard('admin')->guest())
            return redirect(route('Admin.Home.login'));


        $resume_id = $request->get('resume_id');


        $thatResume = Resume::whereId($resume_id)->first();
        if (!$thatResume)
            return response()->json(['level' => 'error', 'message' => '简历已经被删除！']);


        $thatUserInfo = Userinfo::whereUserId($thatResume->user_id)->first();
        if (!$thatUserInfo)
            return response()->json(['level' => 'error', 'message' => '用户数据错误！']);


        $thatUserInfo->photo_url = FileManager::getImgFromOssUrl($thatUserInfo->photo_id);

        $thatJobType = JobType::whereId($thatResume->job_type_id)->first();

        $jobName = $thatJobType ? $thatJobType->name : "无";

        $thatResume->user_info = $thatUserInfo;
        $thatResume->job_name = $jobName;

        $name = ['edu', 'work', 'label'];


        $eduWorkLabel = EduWorkLabel::whereUserId($thatResume->user_id)->get();
        /*
                $thatResume['edu']=array();
                $thatResume['work']=array();
                $thatResume['label']=array();*/
        $result = array();

        if (count($eduWorkLabel) > 0) {
            if (count($name) > 0) {
                foreach ($name as $value) {
                    $type['name'] = $value;
                    $type['list'] = array();

                    $resume[$value] = array();


                    $items = EduWorkLabel::whereType($value)->whereUserId($thatResume->user_id)->get();
                    $typeIds = array();
                    if (count($items) > 0) {
                        foreach ($items as $item) {
                            if ($value == "label") {
                                $typeIds = explode(',', $item->label_id);

                            } else {
                                array_push($typeIds, $item->type_id);
                            }
                        }
                    }

                    if (count($typeIds) > 0) {
                        foreach ($typeIds as $typeId) {

                            if ($value == "edu") {
                                $resume = EducationExperience::whereId($typeId)->first();
                            }
                            if ($value == "work") {
                                $resume = WorkExperience::whereId($typeId)->first();

                            }
                            if ($value == "label") {
                                $resume = SkillLabel::whereId($typeId)->first();

                            }

                            if ($resume){
                                array_push($type['list'], $resume);
                            }

                        }
                    }
                    $thatResume[$value] = $type['list'];

                }
            }
        }else{
            $thatResume['edu']=[];
            $thatResume['work']=[];
            $thatResume['label']=[];
        }

        return view('admin.resume-user-detail', ['thisResume' => $thatResume]);
    }

    public function skillLabelList(Request $request){
        if(Auth::guard('admin')->guest())
            return redirect(route('Admin.Home.login'));

        /** @var SkillLabel $skillLabel */
        $skillLabelList = SkillLabel::orderBy('created_at','desc')->paginate(30);

        return view('admin.skill-label-list',['skillLabelList' => $skillLabelList]);
    }
}